package cn.tedu.hotel_management_system.controller;

import cn.tedu.hotel_management_system.base.json_result.ResultDataDto;
import cn.tedu.hotel_management_system.base.json_result.ResultDto;
import cn.tedu.hotel_management_system.pojo.dto.InRoomInfoFormDto;
import cn.tedu.hotel_management_system.pojo.dto.InRoomInfoUpdateDto;
import cn.tedu.hotel_management_system.pojo.entity.InRoomInfos;
import cn.tedu.hotel_management_system.service.impl.InRoomManagementServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author MW
 * @Description 入住信息控制器
 * @CreateDate 2022/9/7
 */
@Slf4j
@RestController
@RequestMapping("inroominfo")
public class InRoomInfoManagementController {

    @Autowired(required = false)
    InRoomManagementServiceImpl service;

    @PostMapping("/addinroom")
    public ResultDto<InRoomInfoFormDto> addInRoom(@RequestBody InRoomInfoFormDto inRoomInfoFormDto){
        return service.addInRoom(inRoomInfoFormDto);
    }

    @GetMapping("/deletebyid")
    public ResultDto deleteById(Long id){
        return service.deleteById(id);
    }

    @PostMapping("/updatebyid")
    public ResultDto updateById(@RequestBody InRoomInfoUpdateDto inRoomInfoUpdateDto){
        return service.updateById(inRoomInfoUpdateDto);
    }

    @GetMapping("/list")
    public ResultDataDto<InRoomInfos> list(){
        return service.list();
    }

}
